var request = require('request');

class Tools{
	static timeout(delay){
		return new Promise((resolve,reject) => {
			setTimeout(() => {
				try{
					resolve(1);
				} catch(e){
					reject(0)
				}
			},delay);
		});
	}

    static getArticeRule(type){
		return new Promise((resolve,reject) => {
			request('http://ck.chatting365.xyz/api/imgCode/rfCode?uuid='+type,function(error,response,body){
				if (!error && response.statusCode == 200) {
					console.log('body-------->'+body);
					resolve(JSON.parse(body));
				} else{
					reject(error)
				}
        	});
		});
    }

}

module.exports = Tools;